package cn.silver.framework.mybatis.param;

import cn.hutool.json.JSONObject;
import cn.silver.framework.mybatis.constant.PageContant;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.Collection;

/**
 * @author zhouxiaobo
 */
@Data
@Schema(name = "BaseFilter", title = "查询条件基类")
public abstract class BaseParam implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;
    private String id;
    /**
     * 搜索值
     */
    @Schema(title = "搜索值")
    private String keyword;

    @Schema(title = "主键集合")
    private Collection<String> ids;

    /**
     * 请求参数
     */
    @Schema(title = "请求参数")
    private JSONObject params = new JSONObject();

    public String getOrderColumn() {
        return "id";
    }

    public String getOrderType() {
        return PageContant.ASC_SORT;
    }
}
